/*
 * Copyright 2007-2009 Perttu "celeron55" Ahola <celeron55@gmail.com>
 *
 * This file is part of jukumagic.
 *
 * jukumagic is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * jukumagic is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with jukumagic.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef BOARDPOINT_H_
#define BOARDPOINT_H_

#include "common.h"

//units in mil

class BoardPoint
{
public:
	int m_x, m_y;
	bool exists;
	BoardPoint();
	BoardPoint(const BoardPoint &p);
	BoardPoint(int x, int y);
	~BoardPoint();
	void operator=(BoardPoint p);
	bool operator==(BoardPoint p);
	bool operator!=(BoardPoint p);
	void operator+=(BoardPoint p);
	void operator-=(BoardPoint p);
	BoardPoint operator+(BoardPoint p);
	BoardPoint operator-(BoardPoint p);
	static int DistanceSquared(BoardPoint p1, BoardPoint p2);
};

/*
	Board /Hole/ Point?
*/
class BoardHPoint
{
public:
	int m_x, m_y;
	bool exists;
	BoardHPoint();
	BoardHPoint(const BoardHPoint &p);
	BoardHPoint(const BoardPoint &p);
	BoardHPoint(int x, int y);
	~BoardHPoint();
	void operator=(BoardHPoint p);
	bool operator==(BoardHPoint p);
	bool operator!=(BoardHPoint p);
	void operator+=(BoardHPoint p);
	void operator-=(BoardHPoint p);
	BoardHPoint operator+(BoardHPoint p);
	BoardHPoint operator-(BoardHPoint p);
};

class BoardSize
{
public:
	unsigned int m_w, m_h;
	BoardSize();
	BoardSize(const BoardSize &p);
	BoardSize(unsigned int w, unsigned int h);
	~BoardSize();
	void operator=(BoardSize p);
};

class BoardRect
{
public:
	int m_x, m_y;
	unsigned int m_w, m_h;
	//bool point_exists;
	BoardRect();
	BoardRect(const BoardRect &p);
	BoardRect(int x, int y, unsigned int w, unsigned int h);
	~BoardRect();
	void operator=(BoardRect p);
	void SetPoint(BoardPoint p);
	BoardPoint GetPoint();
	void SetSize(BoardSize s);
	BoardSize GetSize();

	bool Collides(BoardRect r);
	bool Contains(BoardRect r);
};

#endif

